//ConcreteHandler.java
package responsibilityChain;

/**
 *@author:youtubezou
 *@version:2012-8-5
 */
public class ConcreteHandler extends Handler
{
	@Override
	public void handleRequest()
	{
		if(getSuccessor() != null){
			System.out.println(this.getClass().getSimpleName() + id + " : Received!");
			System.out.println("The request pass to " + getSuccessor().getClass().getSimpleName() 
					+ getSuccessor().getId());
			try {
				Thread.sleep((long)(Math.random()*10000));
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			successor.handleRequest();
		} else {
			System.out.println("Handler" + id + " : the request handled hear!");
		}

	}
}
